GHC’s OverloadedRecordDot
language extension provides a dot (.
) syntax to refer to the field of a record expression. I was interested in the history of that development.
History
Key events in the history are:
- 1990-04-01 Report on the Programming Language Haskell – A Non-strict, Purely Functional Language – Version 1.0 is published. The committee aimed to design a language that was suitable for applications, including building large systems. The report defined an infix composition operator:
(.) :: (b -> c) -> (a -> b) -> a -> c
. - 1996-05-01 Version 1.3 of the Report on the Programming Language Haskell is published. This introduces qualified names written as modid.name, without white space between the qualifier and the name.
- 1999-09-06 Mark P. Jones and Simon Peyon Jones publish paper “Lightweight Extensible Records for Haskell“. The authors refer to the “traditional dot notation” where an expression
r.l
returns thel
component in the recordr
. They identify that(.)
is used for composition, and suggest that another symbol is used for that purpose, such as#
. - 2002-07-11 GHC 5.04 is released. It supports an extension to the syntax of module names, allowing a module name to contain a dot ‘
.
‘. - 2012-07-25 Edward Kmett uploads the
lens-0.1
package to Hackage. Lens can be composed using(.)
, such that(.) :: Lens' a b -> Lens' b c -> Lens' a c
. This is in the ‘opposite order’ from what one might expect as a functional programmer. Idiomatic use of the library sees the(.)
operator used without white space on either side. - 2016-01-03 “Unable to infer type when using
DuplicateRecordFields
” is opened as an issue on GHC’s issue tracker. This issue will be referred to as one motivation for the subsequentOverloadedRecordFields
Proposal. - 2016-05-21 The
DuplicateRecordFields
language extension is implemented with the release of GHC 8.0.1. - 2016-08-23 The
OverloadedRecordFields
Proposal is proposed. - 2017-01-19 The GHC Steering Committee is formed and begins its work.
- 2017-02-04 The
OverloadedRecordFields Proposal
is accepted. - 2018-08-10 The Add
setField
toHasField
Proposal is proposed (asrecord-set-field
). - 2019-01-22 The Add
setField
toHasField
Proposal is accepted. - 2019-10-11 The Record Dot Syntax Proposal is proposed by Neil Mitchell and Shayne Fletcher, having been used in production by them for 18 months before making the proposal. It received the immediate support of Simon Peyton Jones, the co-Chair of the GHC Steering Committee, in the following terms: “I strongly support the direction of travel of this proposal. I’ve wanted to use dot-notation for record selection since forever; and this looks like a very plausible way to do so.” Neil provides a presentation and slides in support of the proposal. However, some people did not agree with the proposal, especially as originally written, including Roman Kireev (
@effectfully
on GitHub). Roman was concerned about syntax stealing whenmakeFields
from thelens
package already ‘solved’ Haskell’s record problem. At one point (on 2019-10-29) Chris Done remarked: “I gathered from the discussion so far that we do not put any weight behind established conventions of almost every popular language out there.” Simon considered it premature to draw that conclusion, remarking: “I think it is entirely legitimate for you to … present examples from mainstream languages as illustrations of points you want to make. Please don’t feel discouraged from doing so.“ - 2019-11-27 Neil Mitchell posts that after 350 comments, he wishes to pass the Record Dot Syntax Proposal to the GHC Steering Committee.
- 2019-12-09 Simon Peyton Jones explains that he is the shepherd for the Record Dot Syntax Proposal, and strongly recommending its acceptance.
- 2020-02-07 Simon Peyton Jones commences a voting process with the GHC Steering Committee.
- 2020-03-06 Simon Peyton Jones re-commences a voting process with the GHC Steering Committee, which will involve ranking alternative options. The committee’s 12 members were Christopher Allen, Vitaly Bragilevsky, Joachim Breitner, Iavor Diatchki, Richard Eisenberg, Cale Gibbard, Tom Harding, Simon Marlow, Simon Peyton-Jones, Eric Seidel, Alejandro Serrano and Arnaud Spiwack. One of the options was to reject the proposal, and that was Christopher Allen’s first (and only) preference and Cale Gibbard’s first preference. The other options were to accept the proposal but with variants in respect of the legality and, if legal, meaning of a naked selector
.x
or.x.y.z
. The ‘winning’ option was that a naked selector was illegal, except when parenthesised, and thatf (g r).x
meansf ((g r).x)
rather thanf (g r) .x
. - 2020-04-03 Simon Peyton Jones announces that the GHC Steering Committee had come to a conclusion on the Record Dot Syntax Proposal, and provides a link to the publication of the members’ discussion.
- 2020-05-03 The Record Dot Syntax Proposal is accepted.
- 2021-03-09 The accepted Record Dot Syntax Proposal is amended.
- 2021-10-29 The Record Dot Syntax Proposal is implemented with the release of GHC 9.2.1.